"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountReqHandler = void 0;
const ErrorCode_1 = require("../src/config/ErrorCode");
const GameConfig_1 = require("../src/config/GameConfig");
const ServerConfig_1 = require("../src/config/ServerConfig");
const Logger_1 = require("../src/engine/utils/Logger");
const Md5Helper_1 = require("../src/engine/utils/Md5Helper");
const WebUtil_1 = require("../src/engine/utils/WebUtil");
const ResponseModel_1 = require("../src/model/ResponseModel");
const ServerManager_1 = require("../src/server/ServerManager");
const AccountDao_1 = require("./dao/AccountDao");
const WechatSdkManager_1 = require("./WechatSdkManager");
const Base64Helper_1 = require("../src/engine/utils/Base64Helper");
const RandomUtil_1 = require("../src/engine/utils/RandomUtil");
const HttpUtil_1 = require("../src/engine/utils/HttpUtil");
const AccountModel_1 = require("./model/AccountModel");
const request = require('request');
const crypto = require("crypto");
const routerMap = {
    updateServerStatus: "/updateServerStatus",
    register: "/register",
    account_auth: "/account_auth",
    wechat_auth: "/wechat_auth",
    phone_auth: "/phone_auth",
    wechat_account_auth: "/wechat_account_auth",
    bindPhone: "/bindPhone",
    phoneRegister: "/phoneRegister",
    getPhoneCode: "/getPhoneCode",
    reset_pass: "/reset_pass"
};
class AccountReqHandler {
    init(app) {
        for (const key in routerMap) {
            app.use(routerMap[key], this.onBaseRoot.bind(this));
        }
    }
    onBaseRoot(req, resp) {
        try {
            let ip = WebUtil_1.WebUtil.getIpByExpressReq(req);
            Logger_1.Logger.log("onBaseRoot==", ip, req.baseUrl);
            if (req.baseUrl == routerMap.updateServerStatus) {
                ServerConfig_1.ServerConfig.initConfig(ServerConfig_1.ServerConfig.nowServerConfig.nowPort);
                resp.end("success");
            }
            else if (req.baseUrl == routerMap.register) {
                this.checkBody(ip, req, resp, this.on_register.bind(this));
            }
            else if (req.baseUrl == routerMap.account_auth) {
                this.checkBody(ip, req, resp, this.on_account_auth.bind(this));
            }
            else if (req.baseUrl == routerMap.wechat_account_auth) {
                this.checkBody(ip, req, resp, this.on_wechat_account_auth.bind(this));
            }
            else if (req.baseUrl == routerMap.wechat_auth) {
                this.checkBody(ip, req, resp, this.on_wechat_auth.bind(this));
            }
            else if (req.baseUrl == routerMap.bindPhone) {
                this.checkBody(ip, req, resp, this.on_bindPhone.bind(this));
            }
            else if (req.baseUrl == routerMap.phoneRegister) {
                this.checkBody(ip, req, resp, this.on_phoneRegister.bind(this));
            }
            else if (req.baseUrl == routerMap.getPhoneCode) {
                this.checkBody(ip, req, resp, this.on_getPhoneCode.bind(this));
            }
            else if (req.baseUrl == routerMap.phone_auth) {
                this.checkBody(ip, req, resp, this.on_phone_auth.bind(this));
            }
            else if (req.baseUrl == routerMap.reset_pass) {
                this.checkBody(ip, req, resp, this.on_reset_pass.bind(this));
            }
        }
        catch (error) {
            Logger_1.Logger.warn("onBaseRoot error", error);
        }
    }
    checkQuery(ip, req, resp, callback) {
        if (req.query) {
            try {
                let jsonObj = req.query;
                let k = jsonObj["k"];
                let dataStr = jsonObj["data"];
                if (k == Md5Helper_1.Md5Helper.getMd5_encrypt(dataStr)) {
                    let data = JSON.parse(dataStr);
                    callback && callback(req, resp, data, ip);
                }
                else {
                    Logger_1.Logger.error("收到非法Http请求 key", ip, jsonObj);
                    resp.end();
                }
            }
            catch (error) {
                Logger_1.Logger.error("收到非法Http请求query", ip, req.query, error);
                resp.end();
            }
        }
        else {
            resp.end();
        }
    }
    checkBody(ip, req, resp, callback) {
        if (req.body) {
            try {
                let jsonObj = JSON.parse(req.body);
                let k = jsonObj["k"];
                let data = jsonObj["data"];
                if (k == Md5Helper_1.Md5Helper.getMd5_encrypt(JSON.stringify(data))) {
                    callback && callback(req, resp, data, ip);
                }
                else {
                    Logger_1.Logger.error("收到非法Http请求 key", ip, req.body);
                    resp.end();
                }
            }
            catch (error) {
                Logger_1.Logger.error("收到非法Http请求body", ip, req.body, error);
                resp.end();
            }
        }
        else {
            resp.end();
        }
    }
    on_phoneRegister(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            let phone = data["phone"];
            let code = data["code"];
            let pass = data["pass"];
            let channel = data["channel"];
            let os = data["os"];
            let phone_type = data["phone_type"];
            let bundle_name = data["bundle_name"];
            let system_version = data["system_version"];
            Logger_1.Logger.log("on_phoneRegister==", data);
            if (AccountModel_1.AccountModel.phoneCodeMap.get(phone) == code) {
                let accountResult = yield AccountDao_1.AccountDao.get_account_info(phone);
                if (accountResult) {
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "该手机已注册账号")));
                }
                else {
                    accountResult = yield AccountDao_1.AccountDao.getAccountByPhone(phone);
                    if (accountResult) {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "该手机已绑定微信账号")));
                    }
                    else {
                        let token = Md5Helper_1.Md5Helper.createToken(phone);
                        let isSuc = yield AccountDao_1.AccountDao.create_account(phone, pass, GameConfig_1.GameConfig.Account_Type.Phone, token, GameConfig_1.GameConfig.Status_Type.Normal, ip, phone, channel, os, phone_type, bundle_name, system_version);
                        Logger_1.Logger.log("on_phoneRegister=222=", isSuc);
                        if (isSuc) {
                            let data = {
                                "account": phone,
                                "token": token,
                                "nickname": phone,
                                "sex": 1,
                                "headimgurl": "",
                                "account_type": GameConfig_1.GameConfig.Account_Type.Phone
                            };
                            // data["server"] = await this.getHallServer(unionid)
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "", data)));
                        }
                    }
                }
            }
            else {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "验证码不对")));
            }
        });
    }
    on_register(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            Logger_1.Logger.log("on_register=", data, ip);
            let account = data["account"];
            account = Base64Helper_1.Base64Helper.encode(account);
            let password = data["password"];
            let channel = data["channel"];
            let os = data["os"];
            let phone_type = data["phone_type"];
            let bundle_name = data["bundle_name"];
            let system_version = data["system_version"];
            let isExist = yield AccountDao_1.AccountDao.is_account_exist(account);
            // Logger.log("on_register===isExist=", isExist)
            if (isExist) {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "已存在账号")));
            }
            else {
                let token = Md5Helper_1.Md5Helper.createToken(account);
                let isSuc = yield AccountDao_1.AccountDao.create_account(account, password, GameConfig_1.GameConfig.Account_Type.Account, token, GameConfig_1.GameConfig.Status_Type.Normal, ip, Base64Helper_1.Base64Helper.decode(account), channel, os, phone_type, bundle_name, system_version);
                if (isSuc) {
                    let data = {
                        "account": Base64Helper_1.Base64Helper.decode(account),
                        "token": token,
                        "nickname": Base64Helper_1.Base64Helper.decode(account),
                        "sex": 1,
                        "headimgurl": "",
                        "account_type": GameConfig_1.GameConfig.Account_Type.Account
                    };
                    // data["server"] = await this.getHallServer(unionid)
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "", data)));
                }
                else {
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "数据库错误，创建账号失败")));
                }
            }
        });
    }
    on_account_auth(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            Logger_1.Logger.log("on_account_auth=", data, ip);
            let account = data["account"];
            account = Base64Helper_1.Base64Helper.encode(account);
            let password = data["password"];
            let channel = data["channel"];
            let os = data["os"];
            let phone_type = data["phone_type"];
            let bundle_name = data["bundle_name"];
            let system_version = data["system_version"];
            let accountResult = yield AccountDao_1.AccountDao.get_account_info(account);
            Logger_1.Logger.log("on_account_auth=2222===", accountResult);
            if (accountResult) {
                if (password == accountResult["password"]) {
                    if (accountResult["status"] == GameConfig_1.GameConfig.Status_Type.FengJin) {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "用户被冻结")));
                    }
                    else {
                        let token = Md5Helper_1.Md5Helper.createToken(account);
                        let isUpdateSuc = yield AccountDao_1.AccountDao.update_login(account, token, ip, accountResult["nick_name"], channel, os, phone_type, bundle_name, system_version);
                        if (isUpdateSuc) {
                            let respData = {
                                "account": Base64Helper_1.Base64Helper.decode(account),
                                "token": token,
                                "nickname": accountResult["nick_name"],
                                "sex": accountResult["sex"],
                                "headimgurl": accountResult["headimgurl"],
                                "account_type": GameConfig_1.GameConfig.Account_Type.Account
                            };
                            // Logger.log("on_account_auth=3333===", isUpdateSuc)
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "", respData)));
                        }
                        else {
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Db_Error, "数据库错误")));
                        }
                    }
                }
                else {
                    Logger_1.Logger.log("on_account_auth账号密码不对", password, accountResult["password"]);
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.LoginError_NoPass, "登录密码错误")));
                }
            }
            else {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.LoginError_NoUser, "不存在该用户")));
            }
        });
    }
    on_wechat_account_auth(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            Logger_1.Logger.log("on_wechat_account_auth=", data, ip);
            let account = data["account"];
            let password = data["password"];
            let channel = data["channel"];
            let os = data["os"];
            let phone_type = data["phone_type"];
            let bundle_name = data["bundle_name"];
            let system_version = data["system_version"];
            let accountResult = yield AccountDao_1.AccountDao.get_account_info(account);
            if (accountResult) {
                if (password == accountResult["password"]) {
                    if (accountResult["status"] == GameConfig_1.GameConfig.Status_Type.FengJin) {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "用户被冻结")));
                    }
                    else {
                        let token = Md5Helper_1.Md5Helper.createToken(account);
                        let isUpdateSuc = yield AccountDao_1.AccountDao.update_login(account, token, ip, accountResult["nick_name"], channel, os, phone_type, bundle_name, system_version);
                        if (isUpdateSuc) {
                            let respData = {
                                "account": account,
                                "token": token,
                                "nickname": accountResult["nick_name"],
                                "sex": accountResult["sex"],
                                "headimgurl": accountResult["headimgurl"],
                                "account_type": GameConfig_1.GameConfig.Account_Type.Wechat,
                                "phone": accountResult["phone"],
                            };
                            // Logger.log("on_account_auth=3333===", isUpdateSuc)
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "", respData)));
                        }
                        else {
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Db_Error, "数据库错误")));
                        }
                    }
                }
                else {
                    Logger_1.Logger.log("on_account_auth账号密码不对", password, accountResult["password"]);
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.LoginError_NoPass, "登录密码错误")));
                }
            }
            else {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.LoginError_NoUser, "不存在该用户")));
            }
        });
    }
    on_wechat_auth(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            Logger_1.Logger.log("on_wechat_auth=", data, ip);
            let code = data["code"];
            let channel = data["channel"];
            let os = data["os"];
            let phone_type = data["phone_type"];
            let bundle_name = data["bundle_name"];
            let system_version = data["system_version"];
            WechatSdkManager_1.WechatSdkManager.instance.get_access_token(code, (respData) => {
                if (respData.status == 200) {
                    Logger_1.Logger.log("get_access_token===resp=", respData.data);
                    if (respData.data["errcode"] && respData.data["errmsg"]) {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, respData.data["errmsg"])));
                    }
                    else {
                        let openid = respData.data["openid"];
                        let access_token = respData.data["access_token"];
                        WechatSdkManager_1.WechatSdkManager.instance.get_userinfo(access_token, openid, (respData) => __awaiter(this, void 0, void 0, function* () {
                            if (respData.status == 200) {
                                Logger_1.Logger.log("get_userinfo===resp=", respData.data);
                                if (respData.data["errcode"] && respData.data["errmsg"]) {
                                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, respData.data["errmsg"])));
                                }
                                else {
                                    let unionid = respData.data["unionid"];
                                    let nickname = respData.data["nickname"];
                                    let sex = respData.data["sex"];
                                    let headimgurl = respData.data["headimgurl"];
                                    let token = Md5Helper_1.Md5Helper.createToken(unionid);
                                    let accountResult = yield AccountDao_1.AccountDao.get_account_info(unionid);
                                    let phone = null;
                                    let isSuc = true;
                                    if (accountResult) {
                                        phone = accountResult["phone"];
                                        isSuc = yield AccountDao_1.AccountDao.update_login(unionid, token, ip, nickname, channel, os, phone_type, bundle_name, system_version, sex, headimgurl);
                                    }
                                    else {
                                        isSuc = yield AccountDao_1.AccountDao.create_account(unionid, "123456", GameConfig_1.GameConfig.Account_Type.Wechat, token, GameConfig_1.GameConfig.Status_Type.Normal, ip, nickname, channel, os, phone_type, bundle_name, system_version, sex, headimgurl);
                                    }
                                    if (isSuc) {
                                        let data = {
                                            "account": unionid,
                                            "token": token,
                                            "nickname": nickname,
                                            "sex": sex,
                                            "headimgurl": headimgurl,
                                            "account_type": GameConfig_1.GameConfig.Account_Type.Wechat,
                                            "phone": phone,
                                        };
                                        // data["server"] = await this.getHallServer(unionid)
                                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "", data)));
                                    }
                                    else {
                                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Db_Error, "账号数据库操作失败")));
                                    }
                                }
                            }
                            else {
                                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, respData.statusText)));
                            }
                        }));
                    }
                }
                else {
                    Logger_1.Logger.log("get_access_token===resp==error=", respData.statusText);
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, respData.statusText)));
                }
            });
        });
    }
    on_getPhoneCode(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            let phone = data["phone"];
            let code = RandomUtil_1.default.nextInt(100000, 999999) + "";
            let content = "【广东潮聚】您的验证码是" + code;
            let username = "8041SKoR_1";
            let password = "xmtrp7ky";
            // if (Config.environment == Config.EnvironmentType.xj) {
            //     content = "【闲聚】您的验证码是" + code
            //     username = "8042HDfP_1"
            //     password = "aspbybz4"
            // }
            let reqData = {
                "username": username,
                "password": password,
                "isLongSms": 0,
                "method": "sendSMS",
                "mobile": phone,
                "extenno": "0",
                "priorityFlag": 0,
                "content": content
            };
            AccountModel_1.AccountModel.phoneCodeMap.set(phone, code);
            Logger_1.Logger.log("on_getPhoneCode==", phone, code);
            HttpUtil_1.HttpUtil.request_by_form("http://sms.clsoftware.com:9090/servlet/UserServiceAPI", reqData, (respData) => {
                Logger_1.Logger.log("on_getPhoneCode==", reqData, respData["data"]);
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create()));
            });
        });
    }
    on_bindPhone(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            let account = data["account"];
            let phone = data["phone"];
            let code = data["code"];
            let pass = data["pass"];
            let accountResult = yield AccountDao_1.AccountDao.get_account_info(account);
            if (accountResult) {
                if (accountResult["phone"] && accountResult["phone"] != "") {
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "该账号已经绑定过手机")));
                }
                else {
                    if (AccountModel_1.AccountModel.phoneCodeMap.get(phone) == code) {
                        accountResult = yield AccountDao_1.AccountDao.get_account_info(phone);
                        if (accountResult) {
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "该手机已经已绑定其他账号")));
                        }
                        else {
                            let isSuc = yield AccountDao_1.AccountDao.bindPhone(account, phone, pass);
                            if (isSuc) {
                                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "绑定成功")));
                            }
                            else {
                                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "绑定手机保存失败")));
                            }
                        }
                    }
                    else {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "验证码不对")));
                    }
                }
            }
            else {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "账号不存在")));
            }
        });
    }
    on_phone_auth(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            let phone = data["phone"];
            let password = data["password"];
            let accountResult = yield AccountDao_1.AccountDao.getAccountByPhone(phone);
            if (!accountResult) {
                accountResult = yield AccountDao_1.AccountDao.get_account_info(phone);
            }
            if (accountResult) {
                Logger_1.Logger.log("on_phone_auth==", data, accountResult);
                if (accountResult["password"] == password) {
                    if (accountResult["status"] == GameConfig_1.GameConfig.Status_Type.FengJin) {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "用户被冻结")));
                    }
                    else {
                        let channel = data["channel"];
                        let os = data["os"];
                        let phone_type = data["phone_type"];
                        let bundle_name = data["bundle_name"];
                        let system_version = data["system_version"];
                        let account = accountResult["account"];
                        let token = Md5Helper_1.Md5Helper.createToken(account);
                        let isSuc = yield AccountDao_1.AccountDao.update_login(account, token, ip, accountResult["nick_name"], channel, os, phone_type, bundle_name, system_version, accountResult["sex"], accountResult["headimgurl"]);
                        if (isSuc) {
                            let respData = {
                                "account": account,
                                "token": token,
                                "nickname": accountResult["nick_name"],
                                "sex": accountResult["sex"],
                                "headimgurl": accountResult["headimgurl"],
                                "account_type": GameConfig_1.GameConfig.Account_Type.Wechat,
                                "phone": phone,
                            };
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "", respData)));
                        }
                        else {
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "登录保存用户信息失败")));
                        }
                    }
                }
                else {
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "密码不对")));
                }
            }
            else {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "账号不存在")));
            }
        });
    }
    on_reset_pass(req, resp, data, ip) {
        return __awaiter(this, void 0, void 0, function* () {
            let phone = data["phone"];
            let password = data["password"];
            let code = data["code"];
            let accountResult = yield AccountDao_1.AccountDao.getAccountByPhone(phone);
            if (accountResult) {
                Logger_1.Logger.log("on_reset_pass==", data, accountResult);
                if (accountResult["status"] == GameConfig_1.GameConfig.Status_Type.FengJin) {
                    resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "用户被冻结")));
                }
                else {
                    if (AccountModel_1.AccountModel.phoneCodeMap.get(phone) == code) {
                        let isSuc = yield AccountDao_1.AccountDao.reset_pass(phone, password);
                        if (isSuc) {
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Suc, "")));
                        }
                        else {
                            resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "重置密码保存用户信息失败")));
                        }
                    }
                    else {
                        resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "验证码不对")));
                    }
                }
            }
            else {
                resp.end(JSON.stringify(ResponseModel_1.ResponseModel.create(ErrorCode_1.ErrorCode.Code.Fail, "账号不存在")));
            }
        });
    }
    getHallServer(account) {
        return __awaiter(this, void 0, void 0, function* () {
            let resultServerConfig = yield ServerManager_1.ServerManager.instance.is_in_server(account);
            if (!resultServerConfig) {
                resultServerConfig = ServerConfig_1.ServerConfig.randomHallServer();
            }
            return resultServerConfig;
        });
    }
}
exports.AccountReqHandler = AccountReqHandler;
AccountReqHandler.instance = new AccountReqHandler();
